package com.lingjtx.common.influx.config;

import com.lingjtx.common.thread.config.ObjectPoolTemplateConfig;
import com.lingjtx.common.thread.pooling.ObjectPoolTemplate;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;

import java.net.http.HttpClient;

@Configuration
public class InfluxConfig implements Ordered {

    @Bean("httpObjectPoolTemplate")
    public ObjectPoolTemplate<HttpClient> httpObjectPoolTemplate(ObjectPoolTemplateConfig config) {
        return config.httpObjectPoolTemplate();
    }

    @Bean
    @ConfigurationProperties(prefix = "spring.influx")
    public InfluxProperties influxProperties() {
        return new InfluxProperties();
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
